package com.example.demo.api;

import com.example.demo.model.Person;
import com.example.demo.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hankChan
 *         25/10/2017.
 */
@RestController
public class PersonAPIs {

    @Autowired
    PersonService personService;

    @RequestMapping("/api/person/{name}")
    public Person getPerson(@PathVariable("name") String name) {
        return personService.getPersonByName(name);
    }
}
